#!/usr/bin/env python

audioTypes=[]
audioTypes.extend(['wav','au','aif','aifc','aiff'])                          # uncompressed
audioTypes.extend(['flac','ape','mac','wv','shn','tta'])              # lossless
audioTypes.extend(['mp1','mp2','mp3','mpp','mp+','mpc','ogg','logg','wma','mka','m4a','aac','ac3','ra'])   # lossy
audioTypes.extend(['gmf','midi','hmp','rmi','mid','hmi','mids','cmf','xmi','mus'])  # midi files
audioTypes.extend(['mtz','stm','it','mtm','mdz','psm','amf','ptm','xm','ptz',       # tracker modules
                   'dsm','jb','stz','669','umx','s3m','xmz','s3z','itz','am','mod']) # tracker modules
audioTypes.extend(['sid','nsf','nsfe','gbs','spc'])                    # classic video game music
audioTypes.extend(['miniusf','usf','minigsf','gsf','mini2sf','2sf'])   # not so classic video game music
audioTypes.extend(['minipsf','psf','minipsf2','psf2'])          # playstation music
audioTypes.extend(['dsp','adp','adx','hps'])                    # streamed game music
audioTypes.extend(['ads','afc','ast','emff'])   		# streamed game music
audioTypes.extend(['gcm','genh','idsp','ima','ish'])  		# streamed game music
audioTypes.extend(['mpdsp','mss','mwv','rsd','rsf','rxw'])  	# streamed game music
audioTypes.extend(['song','spd','spt','ss2','str','svs'])  	# streamed game music
audioTypes.extend(['uber','vpk','waa','wam','xa','ymf'])  	# streamed game music
audioTypes.extend(['adpcm','aix','asf','brstm','brstmspm'])	# streamed wii music
audioTypes.extend(['eam','fsb','gca','gsb','gsp','idsp'])	# streamed wii music
audioTypes.extend(['kraw','rwar','rwsd','sad','sng'])		# streamed wii music
audioTypes.extend(['str','strm','sts','thp','wsi','zwdsp'])	# streamed wii music

videoTypes=[]
videoTypes.extend(['avi','mpg','mpeg','m4v','mp4','mp4v','mkv','ogm','ogv','divx','swf','flv','vob','iso','rm'])

archiveTypes=[]
archiveTypes.extend(['zip','rar','7z','ace','par','tar','tgz','gz','bz2','iso','cab','sit','lha','lzh'])

pictureTypes=[]
pictureTypes.extend(['jpg','jpeg','jpe','bmp','png','mng','gif','svg','svgz','tiff','tif','ppm','pgm','pbm','pnm','pdf','swf','ps','wmf','art'])

types={'Audio':audioTypes,'Video':videoTypes,'Archives':archiveTypes,'Pictures':pictureTypes}

import database
db=database.getConnection()

cursor=db.cursor()

for type in types.keys():
    print "%s types:"%type
    for extension in types[type]:
        print "%s, "%extension,
        cursor.execute('select id from extensions where extension=%s',extension)
        if cursor.rowcount>0:
            id=cursor.fetchone()[0]
            cursor.execute('insert ignore into extensiontypes (extensiontype, extensionid) values (%s, %s)',(type,id))
    print 
